ORG 100H

MOV SI, 0

START:
CMP SI, 0
JNE NEXT
LEA BX, ARR
DEC SI
MOV DX, NUM
MOV [BX][SI] + 1, DX
INC SI
JMP NEW
NEXT:
DEC SI
MOV BX, ARR[SI]
INC BX
INC SI
MOV ARR[SI], BX
NEW:
MOV CX, ARR[SI]
CALL OUTCX
INC SI
CMP SI, 10
JE END
JMP START
END:
INT 20H

ARR DB 10 DUP(0)
NUM DW 3

OUTCX PROC
CMP CX, 0
JE ISZERO
LEA DX, NOTZERO
MOV AH, 09H
INT 21H
LEA DX, NEWLINE
MOV AH, 09H
INT 21H
PUSH CX
C:
	CALL OUTPUT
LOOP C
LEA DX, NEWLINE
MOV AH, 09H
INT 21H
POP CX
RET
ISZERO:
LEA DX, ZERO
MOV AH, 09H
INT 21H
LEA DX, NEWLINE
MOV AH, 09H
INT 21H
RET
ZERO DB 'ZERO$'
NOTZERO DB 'NOT ZERO$'
OUTCX ENDP

OUTPUT PROC
LEA DX, STR
MOV AH, 09H
INT 21H
RET
STR DB 'I$'
OUTPUT ENDP

NEWLINE DB 13
DB 10
DB '$'
